﻿#region Copyright
/// <copyright>
/// Copyright (c) 2008 Ilia Shramko.
/// Released under the terms of the GNU General Public License.
/// </copyright>
#endregion

using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;

using Osh.Media;

namespace Osh.ViewRight
{
	public class Timeline : ITimeline
	{
		private ViewRightApplication _player;
		private Timer _timer;

		public Timeline(ViewRightApplication player)
		{
			_player = player;
			_timer = new Timer(new TimerCallback(OnTimer), null, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1));
		}

		private void OnTimer(object o)
		{
			if(this.Change != null)
				this.Change(this, new TimelineChangeArgs(this.CaptureState()));
		}

		#region ITimeline Members
		public ITimelineInfo CaptureState()
		{
			DateTime now = DateTime.UtcNow;
			TimelineInfo info = new TimelineInfo(now, now, now);
			return info;
		}

		public bool CanSeek
		{
			get { return false; }
		}

		public DateTime? SeekTo(DateTime position)
		{
			throw new NotSupportedException();
		}

		public DateTime? SeekBy(int offset)
		{
			throw new NotSupportedException();
		}

		public DateTime? SeekBy(TimeSpan offset)
		{
			throw new NotSupportedException();
		}

		public event EventHandler<TimelineChangeArgs> Change;
		#endregion
	}
}
